from pydantic import BaseModel

def to_camel(string: str) -> str:
    parts = string.split('_')
    return parts[0] + ''.join(word.capitalize() for word in parts[1:])

class CamelModel(BaseModel):
    model_config = {
        "alias_generator": to_camel,
        "validate_by_name": True,   # ✅ Pydantic V2 必须用 validate_by_name
        "from_attributes": True     # ✅ ORM 模型必须加
    }
